#7_1基础循环-练习2
import random
num = random.randint(1,100)
flag = True
i = 1
while flag:
    im_num = int(input(f"输入第{i}次猜测："))
    if im_num ==num:
        print(f"恭喜第{i}次猜对！")
        flag=False
    else:
        if im_num>num:
            print("您猜大了！")
        else:
            print("您猜小了！")
        i+=1






#第二种方法

# import random
# num = random.randint(1,100)
# im_num = int(input("猜第1次："))
# i = 1
# while im_num != num:
#     if im_num>num:
#         print("您猜的数字大了！")
#     else:
#         print("您猜的数字小了！")
#     i+=1
#     im_num = int(input(f"猜第{i}次:"))
# print(f"一共猜了{i}次，恭喜猜对！")
